<template>
  <div id="app" v-touch:right="onSwipeRight" v-touch:left="onSwipeLeft">
    <keep-alive>
        <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>


<script>
export default {
  name: "App",
  data() {
    return {
      barCode: ""
    };
  },
  methods: {
    onSwipeLeft() {
      this.$router.go(1);
    },
    onSwipeRight() {
      var currentPath = this.$route.path;
      //防止跳转到 登录页面
      let indexNavagation = currentPath.indexOf("navagation");
      let indexMaterial = currentPath.indexOf("material");
      let indexToInStorageMaterial = currentPath.indexOf("MaterialDetail");

      let OutCodeDetail = currentPath.indexOf("OutCodeDetail");
      let articleList = currentPath.indexOf("articleList");
      let MoveStore = currentPath.indexOf("MoveStore");
      //扫码页面 主页页面 不能返回;
      if (indexNavagation > -1 || indexMaterial > -1 || OutCodeDetail > -1 || articleList >-1 || MoveStore > -1) {
        return;
      }

      if(indexToInStorageMaterial>-1){
        return;
      }

      this.$router.go(-1);
    },

    barCodeScan(code) {
      this.barCode = code;
      console.log(code);
    }
  },
  created() {
    window.barCodeScan = this.barCodeScan;
  },
  computed: {},
  components: {}
};
</script>

<style >
@import "styles/common.scss";

.app {
  width: 100vw;
  /* height: 100vh; */
}
#app {
  /* font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50; */
  text-align: center;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  padding: 0;
  overflow: scroll;
  background-color: #f6f6f6;
}
.van-button--default{
  background: #2E71FF;
      color: #fff;
}
.van-dialog__cancel{
  background-color: #fff !important;
  color: #000 !important;
}
.van-dialog__header{
  color: #ff976a;
}
/* .van-nav-bar,
.van-tabbar {
  height: 68px;
  justify-content: center;
  display: flex;
}
.van-nav-bar__title {
  margin: auto;
  text-align: center;
}
.van-nav-bar__left {
  position: relative;
  margin: auto 0;
}
.van-search__content input {
  font-size: 22px;
  font-family: PingFangSC-Regular;
  font-weight: 400;
  color: rgba(190, 190, 190, 1);
  line-height: 30px;
  letter-spacing: 1px;
}
.van-field__left-icon {
  justify-content: center;
  display: flex;
  align-items: center;
}
.divider {
  width: 480px;
  height: 1px;
  background-color: #e6e6e6;
}
.van-toast {
  width: 170px;
  height: 158px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 7px;
}
.van-toast__text {
  font-size: 24px;
  font-family: PingFangSC;
  font-weight: 500;
  color: rgba(255, 255, 255, 1);
  line-height: 33px;
}
.messageToast {
  width: 316px;
  height: 97px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 7px;
}
.van-toast .van-image__img {
  width: auto;
  height: auto;
  margin: auto;
}
.van-dialog__header {
  font-size: 24px;
  font-family: PingFangSC;
  font-weight: 400;
  line-height: 33px;
  letter-spacing: 1px;
}
.van-dialog__message {
  font-size: 24px;
  font-family: PingFangSC;
  font-weight: 400;
  line-height: 33px;
  letter-spacing: 1px;
}
.van-dialog__cancel {
  font-size: 22px;
  font-family: PingFangSC;
  font-weight: 400;
  color: rgba(102, 102, 102, 1);
  line-height: 30px;
  letter-spacing: 1px;
}
.van-dialog__confirm {
  font-size: 22px;
  font-family: PingFangSC;
  font-weight: 400;
  color: rgba(102, 102, 102, 1);
  line-height: 30px;
  letter-spacing: 1px;
} */
</style>
